<?php

require_once 'init.inc';
require_once 'cf/mail.inc';

$name = $par->asStr('name');
$email = $par->asStr('email');
$msg = $par->asStr('msg');
$captcha = $par->asStr('icq');

if (!$name || !$email || !$msg || !$captcha) 
{
	header('Location: /');
	exit;
}

if (session::get('code') != $captcha)
{
	session::set(
		'lastSendMsgParams',
		array('name'=>$name, 'email'=>$email, 'msg'=>$msg)
	);
	header('Location: /advertising.php?err');
	exit;
}

$m = new Mail(
	"Сообщение с сайта lodki-palatki.ru",
	"$name ($email) пишет:\n$msg"
);
Mail::send('lodkipalatki@yandex.ru,max.seadesign@gmail.com',$m);

header('Location: /advertising.php?ok');
exit;

//kostyan65@rambler.ru
?>